ARG alt_version
ARG user_name

ARG default_alt_version=p10
ARG default_user_name=user

FROM registry.altlinux.org/alt/alt:${alt_version:-${default_alt_version}}

ARG user_name
ARG default_user_name

RUN \
    apt-get update && \
    apt-get install python3 -y && \
    mkdir /var/log/smart-box && \
    touch /var/log/smart-box/log && \
    chown 500:500 /var/log/smart-box/log && \
    apt-get clean && \
    useradd -m -s /bin/sh ${user_name:-${default_user_name}}

WORKDIR /home/${user_name:-${default_user_name}}
USER ${user_name:-${default_user_name}}

COPY --chown=500:500 --chmod=600 ./box/* ./

ENTRYPOINT ["python3", "./main.py"]
